package ningbo.day07.oopextends;

/**
 * @Author 宁铂
 * @Date 2021/7/18 14:49
 * @Version 1.0
 */
public class TestExtendsDemo {
    /** 本类用于测试继承的入门案例 */
    public static void main(String[] args) {
        DingDing dingDing = new DingDing();
        dingDing.eat();
        System.out.println(dingDing.a);
        dingDing.show();

    }
}

class Animal{
    public void eat(){
        System.out.println("爷爷类");
    }
}

class Cat extends Animal{
    int a = 10;
}

class DingDing extends Cat{
    public void show(){
        System.out.println(a);
        System.out.println("子类");
    }
}